package com.party.course.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.hutool.core.date.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.party.course.mapper.PerformanceInfoMapper;
import com.party.course.domain.PerformanceInfo;
import com.party.course.service.IPerformanceInfoService;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import com.party.common.utils.SecurityUtils;

/**
 * 绩效信息Service业务层处理
 *
 * @author ruoyi
 * @date 2025-05-29
 */
@Service
public class PerformanceInfoServiceImpl extends ServiceImpl<PerformanceInfoMapper, PerformanceInfo> implements IPerformanceInfoService {
    @Autowired
    private PerformanceInfoMapper performanceInfoMapper;

    /**
     * 查询绩效信息
     *
     * @param id 绩效信息主键
     * @return 绩效信息
     */
    @Override
    public PerformanceInfo view(String id) {
        return performanceInfoMapper.selectPerformanceInfoById(id);
    }

    /**
     * 查询绩效信息列表
     *
     * @param performanceInfo 绩效信息
     * @return 绩效信息
     */
    @Override
    public List<PerformanceInfo> findList(PerformanceInfo performanceInfo) {
        return performanceInfoMapper.selectPerformanceInfoList(performanceInfo);
    }

    /**
     * 新增绩效信息
     *
     * @param performanceInfo 绩效信息
     * @return 结果
     */
    @Override
    public int add(PerformanceInfo performanceInfo) {
        performanceInfo.setId(IdUtil.simpleUUID());
        performanceInfo.setDelFlag("0");
        return performanceInfoMapper.insert(performanceInfo);
    }

    /**
     * 修改绩效信息
     *
     * @param performanceInfo 绩效信息
     * @return 结果
     */
    @Override
    public int updateEntity(PerformanceInfo performanceInfo) {
        performanceInfo.setUpdateTime(DateUtil.date());
        return performanceInfoMapper.updateById(performanceInfo);
    }

    /**
     * 批量删除绩效信息
     *
     * @param ids 需要删除的绩效信息主键
     * @return 结果
     */
    @Override
    public int deleteIds(List<String> ids) {
        return performanceInfoMapper.deletePerformanceInfoByIds(ids);
    }

    /**
     * 删除绩效信息信息
     *
     * @param id 绩效信息主键
     * @return 结果
     */
    @Override
    public int deleteById(String id) {
        return performanceInfoMapper.deletePerformanceInfoById(id);
    }
}
